
#include "MainView.h"
#include "MainFrame.h"
#include "FontsetNotebook.h"

IMPLEMENT_DYNAMIC_CLASS( MainView, wxView )

MainView::MainView(void)
{
    wxLogTrace( wxTraceMask(), wxT( "MainView::MainView" ) );
    SetFrame( wxTheApp->GetTopWindow() );
}

void MainView::OnDraw( wxDC* dc )
{
    wxLogTrace( wxTraceMask(), wxT( "MainView::OnDraw" ) );
}

void MainView::OnUpdate( wxView* sender, wxObject* hint )
{
    wxLogTrace( wxTraceMask(), wxT( "MainView::OnUpdate" ) );
}

bool MainView::OnClose( bool deleteWindow )
{
    wxLogTrace( wxTraceMask(), wxT( "MainView::OnClose" ) );
    if ( !GetDocument()->Close() )
    {
        return false;
    }

    SetFrame( NULL );
    Activate( false );
    return true;
}

FontsetNotebook* MainView::GetNotebook()
{
    do
    {
        MainFrame* frame = wxDynamicCast( GetFrame(), MainFrame );
        if ( !frame )
            break;
        return frame->mTabbedProjectContainer;

    } while ( false );

    return NULL;
}
